import 'package:flutter/material.dart';
class BottomNavigationBarNv extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
     return _BottomNavigationBarIndex();
  }
}
class _BottomNavigationBarIndex extends State<BottomNavigationBarNv>{
  int _currentIndex=0;
  void onTapHandlerTap(int indexType){
    setState(() {
      _currentIndex=indexType;
    });
  }
  @override
  Widget build(BuildContext context) {
     return BottomNavigationBar(
         type: BottomNavigationBarType.fixed,//不设置这个属性最多只能显示3
         fixedColor: Colors.black,
         currentIndex: _currentIndex,
         onTap: onTapHandlerTap,
         items: [
           BottomNavigationBarItem(icon: Icon(Icons.explore),label: "Explore"),
           BottomNavigationBarItem(icon: Icon(Icons.history),label: "History"),
           BottomNavigationBarItem(icon: Icon(Icons.hiking_outlined),label: "History"),
           BottomNavigationBarItem(icon: Icon(Icons.person),label: "My"),
         ]);
  }

}